package cn.xiaohuodui.rest;

import cn.xiaohuodui.annotation.LoginUser;
import cn.xiaohuodui.res.JsonRes;
import cn.xiaohuodui.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * Created by TR on 2018/4/3.
 */
@RestController
@RequestMapping("/wx/cart")
public class CartApi {

    @Autowired
    CartService cartService;

    /*
   * 获取购物车商品的总件件数
   * 用户也是可选登录，如果没有登录，则返回空数据
   */
    @RequestMapping("goodscount")
    public JsonRes<Map<String,Object>> goodscount(@LoginUser Integer userId) {
        return cartService.goodscount(userId);
    }
}
